<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
<h1>修改</h1>
<input v-model="product.id" placeholder="商品id"><br>
<input v-model="product.title" placeholder="商品名字"><br>
<input v-model="product.price" placeholder="商品价格"><br>
<input v-model="product.num" placeholder="商品库存"><br>
<input type="button" value="修改" @click="update()">
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
   <script src=" https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
     <script>
       let v=new Vue({
         el:"body>div",
         data:{
           product: {
             id:"",
             title: "",
             price: "",
             num: ""
           },
         },
         methods:{
           update(){
             axios.post("/update",v.product).then(function (r) {
               location.href="list.html";
             })
           }
         },
         created:function (){
           axios.post("/select1"+location.search).then(function (r) {
             v.product=r.data;
           })
         }
       })

     </script>
</body>
</html>